package com.wysql.ascost.model.info;

import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class InfoFile implements Serializable {
    private static final long serialVersionUID = 1L;


    @ApiModelProperty(value = "主键id")
    private String id;

    @ApiModelProperty(value = "本地存储地址")
    private String locationPath;

    @ApiModelProperty(value = "文件url")
    private String fileUrl;

    @ApiModelProperty(value = "文件大小")
    private Integer fileSize;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "所属业务单据id")
    private String fkSubject;

    @ApiModelProperty(value = "文档类别（1支撑文件2材料模板3佐证文件）")
    private String fkRecord;

    @ApiModelProperty(value = "支撑文件重点内容描述")
    private String importantMemo;

    @ApiModelProperty(value = "后缀名")
    private String suffix;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "创建日期")
    private Date createDate;

    @ApiModelProperty(value = "任务id（查佐证时做区分）")
    private String fkTaskId;

    @ApiModelProperty(value = "原始文件名称")
    private String realName;

    public InfoFile(String id,String locationPath,String fileUrl,Integer fileSize,String fileName,String fkSubject,String fkRecord,String importantMemo,String suffix,Date createDate,String fkTaskId,String realName){

        this.id = id;

        this.locationPath = locationPath;

        this.fileUrl = fileUrl;

        this.fileSize = fileSize;

        this.fileName = fileName;

        this.fkSubject = fkSubject;

        this.fkRecord = fkRecord;

        this.importantMemo = importantMemo;

        this.suffix = suffix;

        this.createDate = createDate;

        this.fkTaskId = fkTaskId;

        this.realName = realName;

    }

    public InfoFile() {
        super();
    }

    public String dateToStringConvert(Date date) {
        if (date != null) {
            return DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
        }
        return "";
    }


}